package com.zhxt.web.controller.reportapi;

import com.zhxt.common.annotation.Log;
import com.zhxt.common.core.controller.BaseController;
import com.zhxt.common.core.domain.AjaxResult;
import com.zhxt.common.core.domain.entity.SysUser;
import com.zhxt.common.enums.BusinessType;
import com.zhxt.common.utils.SecurityUtils;
import com.zhxt.system.domain.ZhxtHxwh;
import com.zhxt.system.service.IHxwhService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;

/**
 * 展示系统首页
 *
 * @author zhxt
 */

@RestController
@RequestMapping("/repapi")
public class RepIndexController extends BaseController {

    @Autowired
    private IHxwhService iHxwhService;

    /**
     * 登录首页,初始化信息展示
     */
    @Log(title = "大屏-登录大屏首页", businessType = BusinessType.OTHER)
    @PostMapping("/init")
    public AjaxResult repInit(){
        AjaxResult ajax = AjaxResult.success();
        //用户信息
        SysUser user = SecurityUtils.getLoginUser().getUser();
        ajax.put("empno",user.getUserName());
        ajax.put("empname",user.getNickName());
        ajax.put("deptname",user.getDept().getDeptName());
        //核心文化
        List<ZhxtHxwh> hxwhList = iHxwhService.getHxwhList();
        iHxwhService.updateItemValue();
        //System.out.println(hxwhList.toString());
        ajax.put("hxwhList", hxwhList);
        return ajax;
    }
}
